﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Easy.BLL;
using Easy.Operation;

namespace Easy.Web.Service.Setting
{
    /// <summary>
    /// 从TulingBuyCrmApp迁移过来，临时使用。
    /// </summary>
    public class UserInfo : BaseHttpHandler
    {

        public override void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            Dictionary<string, object> user = new DataService("systemuser", CurrentUserId).Retrieve_Dic(CurrentUserId);

            Dictionary<string, object> msg = new Dictionary<string, object>();
            msg.Add("SystemUserId", CurrentUserId);
            msg.Add("TLM_name", user["name"]);
            msg.Add("TLM_gh", user["username"]);
            msg.Add("TLM_phone", user["mobile"]);
            msg.Add("TLM_telphone", user["officetel"]);
            msg.Add("TLM_email", user["email"]);
            msg.Add("TLM_userimg", user["userimg"]);

            if (user.ContainsKey("tlm_qq"))
                msg.Add("TLM_qq", user["tlm_qq"]);
            else
                msg.Add("TLM_qq", "");

            if (user.ContainsKey("tlm_spell"))
                msg.Add("TLM_spell", user["tlm_spell"]);
            else
                msg.Add("TLM_spell", "");

            if (user.ContainsKey("tlm_darlingname"))
                msg.Add("TLM_darlingName", user["tlm_darlingname"]);
            else
                msg.Add("TLM_darlingName", "");  

            context.Response.Write(JsonConvert.SerializeObject(msg));
        }
    }
}